FROM php:7.2-fpm

RUN apt-get update && apt-get install -y \
        libpng-dev \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        git zip unzip inetutils-ping \
    && docker-php-ext-install -j$(nproc) iconv \
    && docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd \
    && pecl install redis-4.0.1 \
    && docker-php-ext-enable redis

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
#    && composer config -g repo.packagist composer https://packagist.phpcomposer.com
    && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

#WORKDIR /app

RUN mkdir /var/www/html/app/

COPY ./php/source/ /var/www/html/app/

RUN cd /var/www/html/ && composer require nmred/kafka-php:0.2.*

